import 'package:flutter/material.dart';

main(){
  runApp(MyApp());
}

class MyApp extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("第一个flutter项目"),),
      body: HomeConten(),
    );
  }
}


class HomeConten extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return HomeContenState();
  }

}

class HomeContenState extends State <HomeConten>{
  var flag = true;
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Checkbox(value: flag, onChanged: (value){
            setState(() {
              this.flag = value;
            });
          }),
          Text("同意协议")
        ],
      ),
    );
  }

}

// class HomeContent extends StatelessWidget{
//   @override
//   Widget build(BuildContext context) {
//     return Center(
//       child: Row(
//         mainAxisAlignment: MainAxisAlignment.center,
//         children: [
//           Text("你好"),
//           Checkbox(value: true, onChanged: (value){
//             print(value);
//           })
//         ],
//       ),
//     );
//   }
// }






